﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace AppToolkit.WPF.Application
{
    /// <summary>
    /// Contains support functionality for setting up WPF applications.
    /// </summary>
    public class ApplicationSupport
    {
        /// <summary>
        /// Set the current UI culture from with App.Startup(). Default is german (de-DE).
        /// </summary>
        /// <param name="cultureString"></param>
        public static void SetUICulture(string cultureString = "de-DE")
        {
            // set german UI culture
            var culture = System.Globalization.CultureInfo.GetCultureInfo(cultureString);
            System.Threading.Thread.CurrentThread.CurrentCulture = culture;
            System.Threading.Thread.CurrentThread.CurrentUICulture = culture;

            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement),
                new FrameworkPropertyMetadata(System.Windows.Markup.XmlLanguage.GetLanguage(culture.IetfLanguageTag)));
        }
    }
}
